import { addClass } from "@/api/class"
import { getClass } from "../../api/class"

const state = {
    classList: []
}

const mutations = {
    GET_CLASS(state, payload) {
        state.classList = payload
    }
}

const actions = {
    async addClass({ commit }, classInfo) {
        let res = await addClass(classInfo);
        console.log(res, "res")
    },
    async getClass({ commit }) {
        console.log("ok")
        let res = await getClass()
        console.log(res)
        commit("GET_CLASS", res.data)
        return {
            code: 200,
            msg: "ok",
            data: res.data
        }
    }
}

export default {
    state,
    mutations,
    actions
}